"use strict";
import moment from 'moment'

const registGlobalFilter = function(app) {
    app.config.globalProperties.$filters = {
        moment(dataStr, pattern = 'YYYY-MM-DD HH:mm:ss') {
            return dataStr ? moment(dataStr).format(pattern) : ''
        },
        toFixed(dataStr, pattern = 2) {
            return Number(dataStr).toFixed(pattern)
        },
        abs(dataStr) {
            return Math.abs(dataStr)
        }
    }
};

export default registGlobalFilter